<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>设备信息</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  <script type="text/javascript">
  //编写自定义JS代码
  </script>
 </head>
 <body>
		<t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="roomDeviceController.do?doUpdate" tiptype="3" >
					<input id="id" name="id" type="hidden" value="${device.id }">
					<input id="createName" name="createName" type="hidden" value="${device.createName }">
					<input id="createBy" name="createBy" type="hidden" value="${device.createBy }">
					<input id="createDate" name="createDate" type="hidden" value="${device.createDate }">
					<input id="updateName" name="updateName" type="hidden" value="${device.updateName }">
					<input id="updateBy" name="updateBy" type="hidden" value="${device.updateBy }">
					<input id="updateDate" name="updateDate" type="hidden" value="${device.updateDate }">
		<table style="" cellpadding="0" cellspacing="1" class="formtable">
					<tr>
						<td align="right">
							<label class="Validform_label">
								设备编号:
							</label>
						</td>
						<td class="value">
						     	 <input id="deviceNo" name="deviceNo" type="text" style="width: 150px" 
						     	 class="inputxt" datatype="*" value='${device.deviceNo}' onkeypress="specialTextValidate()">
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">设备编号</label>
						</td>
						<td align="right">
							<label class="Validform_label">
								RFID号:
							</label>
						</td>
						<td class="value">
						     	 <input id="rfidNo" name="rfidNo" type="text" style="width: 150px" 
						     	 class="inputxt"  value='${device.rfidNo}' onkeypress="specialTextValidate()">
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">RFID号</label>
						</td>
					</tr>
					<tr>
					<td align="right">
						<label class="Validform_label">
							所属品牌:
						</label>
					</td>
					<td class="value"> 
                	     <input id="brandId" name="brandId" type="hidden"  value='${device.brand.id}'>               
					     <input id="brandName"  type="text" style="width: 150px" class="inputxt" readonly="readonly" 
					     	datatype="*" value='${device.brand.brandName}' nullmsg="请选择品牌">
					     <t:choose hiddenName="brandId" hiddenid="id" url="dictDeviceBrandController.do?goSelect" name="deviceBrandList"
                          icon="icon-search" title="选择品牌"   textname="brandName" isclear="false" isInit="true"></t:choose>
							
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">品牌</label>
						
					</td>
					<td align="right">
						<label class="Validform_label">
							型号:
						</label>
					</td>
					<td class="value"> 
                	     <input id="modelId" name="modelId" type="hidden"  value='${device.model.id}'>               
					     <input id="modelName"  type="text" style="width: 150px" class="inputxt" readonly="readonly" 
					     datatype="*" value='${device.model.modelName}' nullmsg="请选择型号">
					     <t:choose hiddenName="modelId" hiddenid="id" url="dictDeviceModelController.do?goSelect" name="deviceModelList"
                          icon="icon-search" title="选择品牌" textname="modelName" isclear="false" isInit="true" 
                          beforeReqCallback="beforeSelectBrand" fun='modelSelected'></t:choose>
							
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">型号</label>						
					</td>
				</tr>	
					<tr>
						<td align="right">
							<label class="Validform_label">
								名称:
							</label>
						</td>
						<td class="value">
						     	 <input id="name" name="name" type="text" style="width: 150px" 
						     	 class="inputxt" datatype="*" value='${device.name}' onkeypress="specialTextValidate()">
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">名称</label>
						</td>
						<td align="right">
							<label class="Validform_label">
								单价:
							</label>
						</td>
						<td class="value">
						     	 <input id="price" name="price" type="text" style="width: 150px" class="inputxt"  value='${device.price}'>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">单价</label>
						</td>
					</tr>
					<tr>
						<td align="right">
						<label class="Validform_label">
							所属机房:
						</label>
					</td>
						<td class="value">
						     <input id="roomId" name="roomId" type="hidden" value="${device.computerRoom.id}"  >               
						     <input id="roomNo"  type="text" style="width: 150px"
						     	 class="inputxt" readonly="readonly" datatype="*"
						     	 value="${device.computerRoom.roomNo}">
						     <t:choose hiddenName="roomId" hiddenid="id" url="computerRoomController.do?goSelect" name="computerRoomList"
	                          icon="icon-search" title="选择机房" textname="roomNo" isclear="false" isInit="true" 
	                          fun='roomSelected'></t:choose>
								
						     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">机房</label>
						</td>
						
						<td align="right">
							<label class="Validform_label">
								状态:
							</label>
						</td>
						<td class="value">
							  <t:enumSelect field="stateValue" type="radio"
									  defaultVal="${device.state.value}" 
									  hasLabel="false"  enumClass="com.mengtian_tech.device_mgr.entity.device.DeviceState"
									  title="状态"></t:enumSelect>     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">状态</label>
						</td>
					</tr>
						 <tr>
					<td align="right">
						<label class="Validform_label">
							所在机房行号:
						</label>
					</td>
					<td class="value">
					     	<input  name="rowNumber" type="text" style="width: 150px" class="inputxt" value="${device.rowNumber}" dataType="n"/>
  					</td> 
				 
					<td align="right">
						<label class="Validform_label">
							所在机房列号:
						</label>
					</td>
					<td class="value">
					     <input  name="colNumber" type="text" style="width: 150px" class="inputxt" value="${device.colNumber}" dataType="n"/>
					</td> 
				</tr>
					 
					 <tr>
				 
					<td align="right">
						<label class="Validform_label">
							备注:
						</label>
					</td>
					<td class="value" colspan="4">
						  	<textarea style="width:300px;height:100px;" class="inputxt" rows="6" id="remark" name="remark" maxlength="200">${device.remark}</textarea>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">备注</label>
					</td>			 
				</tr>
			</table>
		</t:formvalid>
 </body>
  <script>
 	function beforeSelectBrand(url){
 		var brandId = $('#brandId').val();
 		if(brandId.length > 10){
 			return  url+ ("&brandId="+brandId);
 		}else{
 			return url;
 		}
 	}
 	
 	function modelSelected(iframe){
 		var brandName =  iframe.getdeviceModelListSelections("brand.brandName")[0];
 		var brandId = iframe.getdeviceModelListSelections("brand.id")[0];
 		
 		if(brandId.length > 10){
 			$('#brandId').val(brandId);
 	 		$('#brandName').val(brandName);	
 		} 
 	}
 	
 	function roomSelected(iframe){
 		var buildingNo =  iframe.getcomputerRoomListSelections("buildingNo")[0];
 		var roomNo = iframe.getcomputerRoomListSelections("roomNo")[0]; 
 		 
 		$('#roomNo').val(buildingNo+"-"+roomNo);
  		 
 	}
 	
 	$(function(){
 		$("#price").keyup(function () {
            var reg = $(this).val().match(/^-?\d*\.?\d{0,2}/);
            var txt = '';
            if (reg != null) {
                txt = reg[0];
            }
            $(this).val(txt);
            
        }).change(function () {
            $(this).keypress();
            var v = $(this).val();
            if (/\.$/.test(v))
            {
                $(this).val(v.substr(0, v.length - 1));
            }
        });
 		
 		$("#balance").keyup(function () {
            var reg = $(this).val().match(/^-?\d*\.?\d{0,2}/);
            var txt = '';
            if (reg != null) {
                txt = reg[0];
            }
            $(this).val(txt);
            
        }).change(function () {
            $(this).keypress();
            var v = $(this).val();
            if (/\.$/.test(v)){
                $(this).val(v.substr(0, v.length - 1));
            }
        });
 	});
 	
 </script>
  <script src = "webpage/com/mengtian_tech/device_mgr/device/deviceType.js"></script>		
